/*
 * @Author: zhang zhijiang 2824735304@qq.com
 * @Date: 2025-04-24 17:19:04
 * @LastEditors: zhang zhijiang 2824735304@qq.com
 * @LastEditTime: 2025-04-26 14:59:21
 * @FilePath: /linux/tcpcalculator/tcpser.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include"tcpserver.hpp"
#include"servercal.hpp"
void usage(std::string proc)
{
    cout<<"usage:"<<proc<<"port"<<endl;
}
int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        usage(argv[0]);
        exit(1);
    }
    uint16_t port =std::stoi(argv[1]);
    calculator cal;
    tcpserver* tsrv = new tcpserver(port,std::bind(&calculator::calculate,&cal,std::placeholders::_1));
    tsrv->init();
    tsrv->start();
    return 0;
}